<?php
namespace app\common\validate;
use think\Validate;
use think\Request;
class MemberShare extends Validate{
    protected $rule =   [
        // 'userid'   => 'require|checkUserid', 
        // 'taskid'   => 'require', 
    ];

    protected $message  =   [
        'userid.require' => '用户不能为空',
        'taskid.require'   => '任务不能为空',
    ];

    protected function checkUserid($value,$rule = '',$data){
    	$iscount = model("MemberTask")->isJoinTask($value,$data['taskid']);//where("userid",$value)->where("taskid",$data['taskid'])->count();
    	if($iscount){
    		return "不能重复领取任务";
    	}
    	else{
    		return true;
    	}
    }
}